<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=2, initial-scale=1.0">
    <title>第一次实验</title>
</head>
<body>
    <!--189000526 谭静-->
   <script>
       /*第一题*/
       function getSum(num1,num2){
           var sum = num1 + num2;
           console.log(num1+"*"+num2+"="+(num1+num2));
       }
       getSum(2,3);


       /*第二题*/
       //getProduct(2,4);
       var getProduct = function (num1, num2){
        console.log(num1+"*"+num2+"="+(num1+num2));
       }
       //修改
       getProduct(2,4);
       //只是将声明提升了，变量并没有提升，变量要先定义后使用
       

       /*第三题*/
       var a = 100;
       function test(){
           console.log(a);
           a = 10;
           console.log(a);
       }
       test();
       console.log(a);


       /*第四题*/
       var a = 10;
       fun1();//函数能够预加载
       function fun1(){
           var b = 20;
           console.log(a);
           console.log(b);
           var a = 30;//变量a的声明被提升，但是赋的值并没有被提升
       }


       /*第五题*/
       function fun2(a, b){
           console.log(arguments[0]);
           console.log(arguments[1]);
           console.log(arguments[2]);
       }
       fun2(1, 2, 3);
  
    
       /*第六题*/
       for(i in fun2(1, 2, 3)) {
        console.log(arguments[i]);
       }


       /*第七题*/
       "use strict";
      num = 100;
    //    //在严格模式下，必须要声明变量数据类型，不然就会报错

      
    //    /*第八题*/
       fun7(1,2);
       function fun7(a,a){
       
           console.log(arguments[0]);
           console.log(arguments[1]);
       }
   //在严格模式下，要求函数的参数名唯一


       /*第九题*/
    try{
        num = 100;
        } catch(err){
        document.write("错误信息："+err.message);
       }
       
   </script>

</body>
</html>